<template>
    <div class="wrapper" ref="wrapper">
        <div class="content">
            <slot></slot>
        </div>
    </div>
</template>

<script>
    import BScroll from 'better-scroll'
    export default {
        name: "scroll",
        data(){
            return {
                scroll:null,
            }
        },
        props:{
            probeType:{
                type:Number,
                default:0
            },
            pullUpLoad:{
                type:Boolean,
                default: true
            }
        },
        mounted() {
            this.scroll = new BScroll(this.$refs.wrapper,{
                click:true,
                probeType: this.probeType,
                pullUpLoad: this.pullUpLoad,
                mouseWheel:true
            })

            this.scroll.on('scroll',(pos)=>{
                console.log(pos);
            })

            this.scroll.on('pullingUp',()=>{
                console.log('到底了');
                this.scroll.refresh();
                this.scroll.finishPullUp()
            })
        },
        methods:{
            backtotop(x,y,time=0){
                this.scroll.scrollTo(x,y,time)
            },
            refresh(){
                this.scroll.refresh();
                this.scroll.finishPullUp()
            },

        }
    }



</script>

<style scoped>

</style>